layui.config({
    base: '/static/js/lib/',
    version: new Date().getTime()
}).use(['layer', "table"], function () {
    $ = layui.jquery;
    var layer = layui.layer;
    var form = layui.form;

    form.on('submit(save)', function (data) {
        var status = $(this).attr("audit");
        layer.confirm("确认审核", {icon: 0, title: '提示'}, function () {
            $.get("/audit/save/concurrent/post", {shopId: data.field.shopId, auditStatus: status}, function (res) {
                if (res.data) {
                    layer.msg("审核成功", {
                        icon: 6, time: 1500, end: function () {
                            closs()
                        }
                    });
                } else {
                    layer.msg(res.errMsg);
                }
            });
        });
        return false;
    });

    form.on('submit(return)', function (data) {
        closs()
    });

    // 关闭当前窗口
    function closs() {
        var index = parent.layer.getFrameIndex(window.name);
        parent.layer.close(index);
    }
});
